Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed b'.' cannot be converted to a float error in parseN #60

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

janneyt
Copy link

@janneyt janneyt commented Oct 30, 2021

I wrote this change because I was importing a .dbf file to Pandas. I was continually getting a set of errors of this format:

ValueError: could not convert string to float: b'.'

I traced it back to the parseN method. What I believe was happening was there were ',' entries with absolutely no digits somehow being flagged as floats. I added the length check to the exception handling to avoid this situation and now my document imports correctly. I have only tested with Python 3.x versions. I also added a test to test_field_parser.py to maintain this behavior.

I chose to convert to NaN and not None because NaN is a float value and because Pandas attempts to convert all missing data to NaN.

…tries of length 1 which cannot be converted to an integer or a float.
Changed parse_L to return None for invalid characters as this is not misleading.
… present. I added a blank dictionary for the header file and raised a FileNotFound error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant